`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: Rohit Kulkarni, Vedang Vaidya
// 
// Create Date:    22:45:09 04/18/2014 
// Design Name: 	 COLORISER
// Module Name:    coloriser 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: Implements the coloriser module which takes inputs from the BOTSIM and the ICON 
//					 modules and outputs a 8 bit colour.
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////

//*********************************************************************************
//									COLORISER MODULE
//*********************************************************************************

module Colorizer(
	input [1:0]		vid_pixel_out,
   input [1:0]		icon,
	input video_on,

	output  [2:0] red,
	output  [2:0] green,
	output  [1:0] blue
 );
	
	//*** Format : RRR_GGG_BB ***
	reg [7:0]	color_out;				

	assign red			=	color_out[7:5];
	assign green		=	color_out[4:2];
	assign blue			=	color_out[1:0];

	always @(*)
	begin
		if (video_on == 1'b1)
		begin
			if(icon == 2'b00)
			begin	
				if(vid_pixel_out[1:0] == 2'b01)
				begin
					color_out = 8'b000_000_00;			//display black line
				end
			
				else if(vid_pixel_out[1:0] == 2'b10)
				begin
					color_out =  8'b111_000_00;		//display red obstruction
				end
				else
				begin
					color_out = 8'b111_111_11;			//display white background
				end	
			end			
			else if(icon == 2'b01)
				begin
					color_out = 8'b111_111_00;			//yellow colour
				end
			
			else if(icon == 2'b10)
				begin
					color_out = 8'b000_000_11;			//blue colour
				end
			
			else
				begin
					color_out =  8'b000_111_00;		//green colour
				end			
			end	
		else	//if video is OFF
		begin
			color_out = 8'b000_000_00; 				//display no colour during blanking period
		end	
	end

	
endmodule

